<template>
    <div class="b-content"> 
        <div class="b-title">全部题库</div>
        <div class="b-table">
            <div class="b-table-title">
                <div style="width:5%">ID</div>
                <div style="width:10%">书名</div>
                <div style="width:8%">简称</div>
                <div style="width:12%">简介</div>
                <div style="width:10%">加入时间</div>
                <div style="width:8%">使用人数</div>
                <div style="width:8%">题目数量</div>
                <div style="width:17%">作者 / 出版社</div>
                <div style="width:8%">状态</div>
                <div style="width:14%">操作</div>
            </div>

            <div class="b-table-row" v-for="(book, index) in allBookList" :key="index">
                <div style="width:5%">{{book.id}}</div>
                <div style="width:10%">{{book.bookName}}</div>
                <div style="width:8%">{{book.abbr}}</div>
                <div style="width:12%">{{book.introduction}}</div>
                <div style="width:10%">{{book.createTime}}</div>
                <div style="width:8%">{{book.usingNum}}</div>
                <div style="width:8%">{{book.questionNum}}</div>
                <div style="width:17%">{{book.author}} / {{book.press}}</div>
                <div style="width:8%">{{book.status == 0 ? '正常':'不正常'}}</div>
                <div style="width:14%" class="b-options">
                    <router-link to="/bookdetail">
                        <div class="b-detail">详情</div>
                    </router-link>
                    <div class="b-detail">编辑</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    import store from '@/store'
    export default {
        name:"Book",
        store,
        data(){
            return {
                allBookList:[],
            }
        },
        mounted(){
            this.init();
        },
        methods:{
            init(){
                this.axios.get('https://www.ydsungan.com/root/listbook').then((res={})=>{
                    this.allBookList = res;
                })
            },
        }
    }
</script>

<style lang="scss">
    @import './../assets/scss/book.scss';
</style>